----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/code/logs/figure_04_phi_vs_manuf_serv.log
  log type:  text
 opened on:  28 Oct 2022, 10:39:50

. *-------------------------------------------------------------------------------
. 
. 
. 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_aggtype_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "LP_ppp_emp_pwt" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str6, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,931
        from master                         0  (_merge==1)
        from using                      2,931  (_merge==2)

    matched                                81  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,931 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }
(1 missing value generated)
(1 missing value generated)

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

.         
. sum `LHS1' `RHS'  `LHS2'

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     D_A_phi |         80   -.2301875    .1777735  -.6154568   .2956024
ln_LP_ppp_.. |         81   -.2767506    .3269977  -1.189091   .3206411
b_D_A_phi_~t |         80   -.0474933    .2796362  -.8363765   .5810399

. local ytitle "{&Delta}`=ustrunescape("\u03D5\u0303")'{sub:n}, {&Delta}`=ustrunescape("\u007A\u0303")'{sub:n}"

. local xtitle "{&Delta}y{sub:n}"

. local firm_emb "{&Delta}`=ustrunescape("\u03D5\u0303")'{sub:n}" 

. local ctry_emb "{&Delta}`=ustrunescape("\u007A\u0303")'{sub:n}"

. local title "Affiliates older than `edad' years"

. local title ""

. 
. tempfile temp

. save `temp', replace
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000m.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000m.tmp saved

. 
. 
. *Manufacturing 
. *-------------------------------------------------------------------------------------
. use `temp', clear

. keep if type=="manuf"
(54 observations deleted)

. 
. reg `LHS1' `RHS'

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     15.60
       Model |   .46849958         1   .46849958   Prob > F        =    0.0006
    Residual |  .750985643        25  .030039426   R-squared       =    0.3842
-------------+----------------------------------   Adj R-squared   =    0.3595
       Total |  1.21948522        26  .046903278   Root MSE        =    .17332

-----------------------------------------------------------------------------------
          D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .3434853    .086976     3.95   0.001     .1643549    .5226156
            _cons |  -.0598828   .0453138    -1.32   0.198    -.1532082    .0334427
-----------------------------------------------------------------------------------

. mat b = e(b)

. mat V = e(V)

. global c1: display %-03.2fc round(b[1,1],0.01)

. global se1: display %-03.2fc round(sqrt(V[1,1]),0.01)

. 
. reg `LHS2' `RHS' 

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     56.98
       Model |  1.71151991         1  1.71151991   Prob > F        =    0.0000
    Residual |  .750985638        25  .030039426   R-squared       =    0.6950
-------------+----------------------------------   Adj R-squared   =    0.6828
       Total |  2.46250555        26  .094711752   Root MSE        =    .17332

-----------------------------------------------------------------------------------
b_D_A_phi_LP_pp~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .6565147    .086976     7.55   0.000     .4773844    .8356451
            _cons |   .0598828   .0453138     1.32   0.198    -.0334427    .1532082
-----------------------------------------------------------------------------------

. mat b = e(b)

. mat V = e(V)

. global c2: display %-03.2fc round(b[1,1],0.01)

. global se2: display %-03.2fc round(sqrt(V[1,1]),0.01)

. 
. display $c1
.34

. display $se1
.09

. display $c2
.66

. display $se2
.09

. 
. 
. global opt1 msymbol(circle_hollow) mlabel(isocode) mlabcolor(red)  msize(small) mlabsize(small)

. global opt2 msymbol(square_hollow) mlabel(isocode) mlabcolor(blue) msize(small) mlabsize(small)

. two (scatter `LHS1' `RHS', sort $opt1  mcolor(red)) (lfit `LHS1' `RHS', lcolor(red)) (line `RHS' `RHS', lcolor(none))  ///
>         (scatter `LHS2' `RHS', sort $opt2  mcolor(blue)) (lfit `LHS2' `RHS', lcolor(blue)) (line `RHS' `RHS', lcolor(none)),  ylabel(-1(0.5)0.5, format(%5.1f) labsize(medlarge)
> ) xlabel(-1.2(0.4)0.4, format(%5.1f) labsize(medlarge)) ///
>         title("`title'", size(small)) ytitle("`ytitle'", size(medlarge)) xtitle("`xtitle'", size(medlarge)) graphregion(fcolor(white) lcolor(white)) ///
>         legend(order(2 "`firm_emb': $c1 ($se1)" 5 "`ctry_emb': $c2 ($se2)") rows(2) size(medlarge) bplace(se) ring(0) region(lwidth(none))) 

. 
.         
. graph export "${rmain}/fig_04_manuf.pdf", replace
(file F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/fig_04_manuf.pdf written in PDF format)

. 
. 
. *Services 
. *-------------------------------------------------------------------------------------
. use `temp', clear

. keep if type=="serv"
(54 observations deleted)

. 
. reg `LHS1' `RHS'

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     11.86
       Model |  .132114333         1  .132114333   Prob > F        =    0.0020
    Residual |  .278439538        25  .011137582   R-squared       =    0.3218
-------------+----------------------------------   Adj R-squared   =    0.2947
       Total |  .410553871        26  .015790533   Root MSE        =    .10553

-----------------------------------------------------------------------------------
          D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .3157702   .0916836     3.44   0.002     .1269443    .5045961
            _cons |  -.1340128   .0281175    -4.77   0.000     -.191922   -.0761037
-----------------------------------------------------------------------------------

. mat b = e(b)

. mat V = e(V)

. global c1: display %-03.2fc round(b[1,1],0.01)

. global se1: display %-03.2fc round(sqrt(V[1,1]),0.01)

. 
. reg `LHS2' `RHS' 

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     55.70
       Model |  .620314191         1  .620314191   Prob > F        =    0.0000
    Residual |  .278439537        25  .011137581   R-squared       =    0.6902
-------------+----------------------------------   Adj R-squared   =    0.6778
       Total |  .898753728        26  .034567451   Root MSE        =    .10553

-----------------------------------------------------------------------------------
b_D_A_phi_LP_pp~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .6842298   .0916836     7.46   0.000     .4954039    .8730557
            _cons |   .1340128   .0281175     4.77   0.000     .0761037     .191922
-----------------------------------------------------------------------------------

. mat b = e(b)

. mat V = e(V)

. global c2: display %-03.2fc round(b[1,1],0.01)

. global se2: display %-03.2fc round(sqrt(V[1,1]),0.01)

. 
. display $c1
.32

. display $se1
.09

. display $c2
.68

. display $se2
.09

. 
. 
. global opt1 msymbol(circle_hollow) mlabel(isocode) mlabcolor(red)  msize(small) mlabsize(small)

. global opt2 msymbol(square_hollow) mlabel(isocode) mlabcolor(blue) msize(small) mlabsize(small)

. two (scatter `LHS1' `RHS', sort $opt1  mcolor(red)) (lfit `LHS1' `RHS', lcolor(red)) (line `RHS' `RHS', lcolor(none))  ///
>         (scatter `LHS2' `RHS', sort $opt2  mcolor(blue)) (lfit `LHS2' `RHS', lcolor(blue)) (line `RHS' `RHS', lcolor(none)),  ylabel(-1(0.5)0.5, format(%5.1f) labsize(medlarge)
> ) xlabel(-0.8(0.2)0.4, format(%5.1f) labsize(medlarge)) ///
>         title("`title'", size(small)) ytitle("`ytitle'", size(medlarge)) xtitle("`xtitle'", size(medlarge)) graphregion(fcolor(white) lcolor(white)) ///
>         legend(order(2 "`firm_emb': $c1 ($se1)" 5 "`ctry_emb': $c2 ($se2)") rows(2) size(medlarge) bplace(se) ring(0) region(lwidth(none))) 

. 
.         
. graph export "${rmain}/fig_04_serv.pdf", replace
(file F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/fig_04_serv.pdf written in PDF format)

.         
. 
end of do-file

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
. 
. *Bring some aggregate control variables
. *----------------------------------------------------------
. merge m:1 year isocode sector using "${data}/aggregates_tfp_lp_klems.dta"
variables year isocode sector1 do not uniquely identify observations in the using data
r(459);

end of do-file

r(459);

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. Journal of Political Economy (2022)
command Journal is unrecognized
r(199);

end of do-file

r(199);

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: table_02_correlation.do
> Date: October 2022
> 
> Description: Reproduces Table 2: Estimating the composite elasticity, \beta.
> 
> *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)
variables year isocode do not uniquely identify observations in the using data
r(459);

end of do-file

r(459);

. use use "${data}/aggregates_tfp_lp_klems_agg.dta", clear
invalid '"F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/data/analysis/aggregates_tfp_lp_klems_agg.dta' 
r(198);

. "${data}/aggregates_tfp_lp_klems_agg.dta"
"F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/data/anal is not a valid command name
r(199);

. use "${data}/aggregates_tfp_lp_klems_agg.dta"
no; dataset in memory has changed since last saved
r(4);

. use "${data}/aggregates_tfp_lp_klems_agg.dta", clear

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. 
end of do-file

. tab type

       type |      Freq.     Percent        Cum.
------------+-----------------------------------
      total |         27      100.00      100.00
------------+-----------------------------------
      Total |         27      100.00

. gen coef_nocontrols=.
(27 missing values generated)

. gen se_nocontrols=.
(27 missing values generated)

. gen coef_cap_hc=.
(27 missing values generated)

. gen se_cap_hc=.
(27 missing values generated)

. local yy_ref=`yy'

. tab type

       type |      Freq.     Percent        Cum.
------------+-----------------------------------
      total |         27      100.00      100.00
------------+-----------------------------------
      Total |         27      100.00

. clear all

. 
. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. 
. 
. local grvar0 "gdp_pw_ppp" 

. 
. local grvar1 ""

. 
. local rr ""

. 
. local var3 "A"

. 
. local yy "2016"

. 
. local yy_ref=`yy'

. 
. replace year=`yy_ref'
(0 real changes made)

. 
. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta"
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. 
. 
. 
. ************************ TABLE 2  **************************

. 
. clear all

. 
. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. 
. 
. local grvar0 "gdp_pw_ppp" 

. 
. local grvar1 ""

. 
. local rr ""

. 
. local var3 "A"

. 
. local yy "2016"

. 
. local yy_ref=`yy'

. 
. replace year=`yy_ref'
(0 real changes made)

. 
. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. 
. drop if _merge==2
(2,985 observations deleted)

. 
. drop _merge

. 
. 
. 
. foreach var in D_A  {
  2. 
. gen `var'_phi=(-1)*`var'*(0.2)
  3. 
. *---------------------------------------
. 
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. 
. }

. 
. 
. 
. local LHS1 D_`var3'_phi

. 
. local LHS2 b_D_`var3'_phi_`grvar0'

. 
. local RHS ln_`grvar0'

. 
. 
. 
. 
. 
. *Bring some aggregate control variables

. 
. *----------------------------------------------------------

. 
. merge m:1 year isocode using "${data}/additional_agg_indicators.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,290
        from master                         0  (_merge==1)
        from using                      1,290  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(1,290 observations deleted)

. 
. drop _merge

. 
. 
. 
. gen k_y=ln_ck-ln_rgdpo

. 
. gen ln_patent=ln(patent_total)

. 
. gen ln_patent_pc=ln_patent-ln_pop

. 
. gen ln_trademark=ln(trademark_application)

. 
. gen ln_trademark_pc=ln_trademark-ln_pop

. 
. gen ln_researcher_permm=ln(Researchers_RD_permm)

. 
. gen ln_mobile_per100=ln(mobile_per100) 

. 
. gen ln_broadband_per100=ln(broadband_per100) 

. 
. gen ln_electric_pc=ln(electric_percapita) 

. 
. gen ln_freshwater_pc=ln(freshwater_percapita) 

. 
. gen ln_air_transp=ln(air_transp) 
(3 missing values generated)

. 
. gen ln_container_port=ln(container_port)
(3 missing values generated)

. 
. gen ln_schooling=ln(schooling)

. 
. egen gov_index=rowmean(PoliticalStability GovernmentEffectiveness RegulatoryQuality RuleofLaw ControlofCorruption)

. 
. egen gov_rank_index=rowmean(PoliticalStability_rank GovernmentEffectiveness_rank RegulatoryQuality_rank RuleofLaw_rank ControlofCorruption_rank)

. 
. 
. 
. tempfile temp

. 
. save `temp', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000m.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000m.tmp saved

. *----------------------------------------

. 
. local var_dep "D_A_phi"

. 
. local typefirm "ln_patent_pc"

. 
. local abslist "year"

. 
. local clusterlist "isocode"

. 
. local variablelist "k_y ln_hc RuleofLaw"

. 
. local yy=2016

. 
. local grvar0 "gdp_pw_ppp" 

. 
. 
. 
. local vardep "ln_`grvar0'"

. 
. reghdfe `vardep' k_y ln_hc  if year==2016, abs(`abslist')  vce(cluster `clusterlist')
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+

. 
. 
. do "F:\Dropbox (UBC-Umich)\Research_Projects\Project Javier and Natalia\TFP firm\TFP_firm_data_historical\dataverse_files\code\main\table_02_correlation.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: table_02_correlation.do
> Date: October 2022
> 
> Description: Reproduces Table 2: Correlations with country characteristics.
> 
> *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
. 
. *Bring some aggregate control variables
. *----------------------------------------------------------
. merge m:1 year isocode using "${data}/additional_agg_indicators.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,290
        from master                         0  (_merge==1)
        from using                      1,290  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(1,290 observations deleted)

. drop _merge

. 
. gen k_y=ln_ck-ln_rgdpo

. gen ln_patent=ln(patent_total)

. gen ln_patent_pc=ln_patent-ln_pop

. gen ln_trademark=ln(trademark_application)

. gen ln_trademark_pc=ln_trademark-ln_pop

. gen ln_researcher_permm=ln(Researchers_RD_permm)

. gen ln_mobile_per100=ln(mobile_per100) 

. gen ln_broadband_per100=ln(broadband_per100) 

. gen ln_electric_pc=ln(electric_percapita) 

. gen ln_freshwater_pc=ln(freshwater_percapita) 

. gen ln_air_transp=ln(air_transp) 
(3 missing values generated)

. gen ln_container_port=ln(container_port)
(3 missing values generated)

. gen ln_schooling=ln(schooling)

. egen gov_index=rowmean(PoliticalStability GovernmentEffectiveness RegulatoryQuality RuleofLaw ControlofCorruption)

. egen gov_rank_index=rowmean(PoliticalStability_rank GovernmentEffectiveness_rank RegulatoryQuality_rank RuleofLaw_rank ControlofCorruption_rank)

. 
. tempfile temp

. save `temp', replace    
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp saved

. 
. 
. 
. *Create table 2
. *----------------------------------------
. local var_dep "D_A_phi"

. local typefirm "ln_patent_pc"

. local abslist "year"

. local clusterlist "isocode"

. local variablelist "k_y ln_hc RuleofLaw"

. local yy=2016

. local grvar0 "gdp_pw_ppp" 

. 
. local vardep "ln_`grvar0'"

. reghdfe `vardep' k_y ln_hc  if year==2016, abs(`abslist')  vce(cluster `clusterlist')
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+

. 
. 
. 
. foreach vardep in "ln_`grvar0'" "D_A_phi" "b_phi"  {
  2. display "`vardep'"
  3. 
. reghdfe `vardep' k_y ln_hc  if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  4. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  5. 
. reghdfe `vardep' k_y ln_hc  gov_rank_index ln_mobile_per100 ln_patent_pc if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  6. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  7. 
. }
ln_gdp_pw_ppp
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =       7.33
Statistics robust to heteroskedasticity           Prob > F        =     0.0004
                                                  R-squared       =     0.5248
                                                  Adj R-squared   =     0.4117
                                                  Within R-sq.    =     0.5248
Number of clusters (isocode) =         27         Root MSE        =     0.2102

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
   ln_gdp_pw_ppp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |   .1826241   .1871454     0.98   0.340    -.2065661    .5718143
           ln_hc |  -.1573474    .629992    -0.25   0.805    -1.467488    1.152793
  gov_rank_index |   .6889771   .3849486     1.79   0.088    -.1115674    1.489522
ln_mobile_per100 |  -.0643084   .5971252    -0.11   0.915    -1.306098    1.177481
    ln_patent_pc |   .0841197   .0365542     2.30   0.032      .008101    .1601384
           _cons |  -.9890033   .3462323    -2.86   0.009    -1.709033   -.2689739
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
D_A_phi
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       0.14
Statistics robust to heteroskedasticity           Prob > F        =     0.8716
                                                  R-squared       =     0.0069
                                                  Adj R-squared   =    -0.0758
                                                  Within R-sq.    =     0.0069
Number of clusters (isocode) =         27         Root MSE        =     0.1683

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
     D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   -.049236   .0941831    -0.52   0.606    -.2436204    .1451484
       ln_hc |  -.0235642   .2734426    -0.09   0.932     -.587922    .5407937
       _cons |  -.2036515   .0307751    -6.62   0.000    -.2671683   -.1401347
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =      12.17
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.6063
                                                  Adj R-squared   =     0.5125
                                                  Within R-sq.    =     0.6063
Number of clusters (isocode) =         27         Root MSE        =     0.1133

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
         D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |  -.0486077   .1036058    -0.47   0.644    -.2640678    .1668523
           ln_hc |  -.3289669   .2130335    -1.54   0.137    -.7719943    .1140606
  gov_rank_index |  -.1346177   .2044615    -0.66   0.517    -.5598187    .2905833
ln_mobile_per100 |  -.1039685   .3395624    -0.31   0.762    -.8101272    .6021903
    ln_patent_pc |   .1093853   .0206781     5.29   0.000     .0663828    .1523878
           _cons |   .0224591   .1905609     0.12   0.907     -.373834    .4187522
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
b_phi
variable b_phi not found
r(111);

end of do-file

r(111);

. do "F:\Dropbox (UBC-Umich)\Research_Projects\Project Javier and Natalia\TFP firm\TFP_firm_data_historical\dataverse_files\code\main\table_02_correlation.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: table_02_correlation.do
> Date: October 2022
> 
> Description: Reproduces Table 2: Correlations with country characteristics.
> 
> *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
. 
. *Bring some aggregate control variables
. *----------------------------------------------------------
. merge m:1 year isocode using "${data}/additional_agg_indicators.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,290
        from master                         0  (_merge==1)
        from using                      1,290  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(1,290 observations deleted)

. drop _merge

. 
. gen k_y=ln_ck-ln_rgdpo

. gen ln_patent=ln(patent_total)

. gen ln_patent_pc=ln_patent-ln_pop

. gen ln_trademark=ln(trademark_application)

. gen ln_trademark_pc=ln_trademark-ln_pop

. gen ln_researcher_permm=ln(Researchers_RD_permm)

. gen ln_mobile_per100=ln(mobile_per100) 

. gen ln_broadband_per100=ln(broadband_per100) 

. gen ln_electric_pc=ln(electric_percapita) 

. gen ln_freshwater_pc=ln(freshwater_percapita) 

. gen ln_air_transp=ln(air_transp) 
(3 missing values generated)

. gen ln_container_port=ln(container_port)
(3 missing values generated)

. gen ln_schooling=ln(schooling)

. egen gov_index=rowmean(PoliticalStability GovernmentEffectiveness RegulatoryQuality RuleofLaw ControlofCorruption)

. egen gov_rank_index=rowmean(PoliticalStability_rank GovernmentEffectiveness_rank RegulatoryQuality_rank RuleofLaw_rank ControlofCorruption_rank)

. 
. tempfile temp

. save `temp', replace    
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp saved

. 
. 
. 
. *Create table 2
. *----------------------------------------
. local var_dep "D_A_phi"

. local typefirm "ln_patent_pc"

. local abslist "year"

. local clusterlist "isocode"

. local variablelist "k_y ln_hc RuleofLaw"

. local yy=2016

. local grvar0 "gdp_pw_ppp" 

. 
. local vardep "ln_`grvar0'"

. reghdfe `vardep' k_y ln_hc  if year==2016, abs(`abslist')  vce(cluster `clusterlist')
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+

. 
. 
. 
. foreach vardep in "ln_`grvar0'" "D_A_phi" "b_DA_phi"  {
  2. display "`vardep'"
  3. 
. reghdfe `vardep' k_y ln_hc  if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  4. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  5. 
. reghdfe `vardep' k_y ln_hc  gov_rank_index ln_mobile_per100 ln_patent_pc if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  6. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  7. 
. }
ln_gdp_pw_ppp
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =       7.33
Statistics robust to heteroskedasticity           Prob > F        =     0.0004
                                                  R-squared       =     0.5248
                                                  Adj R-squared   =     0.4117
                                                  Within R-sq.    =     0.5248
Number of clusters (isocode) =         27         Root MSE        =     0.2102

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
   ln_gdp_pw_ppp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |   .1826241   .1871454     0.98   0.340    -.2065661    .5718143
           ln_hc |  -.1573474    .629992    -0.25   0.805    -1.467488    1.152793
  gov_rank_index |   .6889771   .3849486     1.79   0.088    -.1115674    1.489522
ln_mobile_per100 |  -.0643084   .5971252    -0.11   0.915    -1.306098    1.177481
    ln_patent_pc |   .0841197   .0365542     2.30   0.032      .008101    .1601384
           _cons |  -.9890033   .3462323    -2.86   0.009    -1.709033   -.2689739
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
D_A_phi
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       0.14
Statistics robust to heteroskedasticity           Prob > F        =     0.8716
                                                  R-squared       =     0.0069
                                                  Adj R-squared   =    -0.0758
                                                  Within R-sq.    =     0.0069
Number of clusters (isocode) =         27         Root MSE        =     0.1683

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
     D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   -.049236   .0941831    -0.52   0.606    -.2436204    .1451484
       ln_hc |  -.0235642   .2734426    -0.09   0.932     -.587922    .5407937
       _cons |  -.2036515   .0307751    -6.62   0.000    -.2671683   -.1401347
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =      12.17
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.6063
                                                  Adj R-squared   =     0.5125
                                                  Within R-sq.    =     0.6063
Number of clusters (isocode) =         27         Root MSE        =     0.1133

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
         D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |  -.0486077   .1036058    -0.47   0.644    -.2640678    .1668523
           ln_hc |  -.3289669   .2130335    -1.54   0.137    -.7719943    .1140606
  gov_rank_index |  -.1346177   .2044615    -0.66   0.517    -.5598187    .2905833
ln_mobile_per100 |  -.1039685   .3395624    -0.31   0.762    -.8101272    .6021903
    ln_patent_pc |   .1093853   .0206781     5.29   0.000     .0663828    .1523878
           _cons |   .0224591   .1905609     0.12   0.907     -.373834    .4187522
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
b_DA_phi
variable b_DA_phi not found
r(111);

end of do-file

r(111);

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: table_02_correlation.do
> Date: October 2022
> 
> Description: Reproduces Table 2: Correlations with country characteristics.
> 
> *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
. 
. *Bring some aggregate control variables
. *----------------------------------------------------------
. merge m:1 year isocode using "${data}/additional_agg_indicators.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,290
        from master                         0  (_merge==1)
        from using                      1,290  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(1,290 observations deleted)

. drop _merge

. 
. gen k_y=ln_ck-ln_rgdpo

. gen ln_patent=ln(patent_total)

. gen ln_patent_pc=ln_patent-ln_pop

. gen ln_trademark=ln(trademark_application)

. gen ln_trademark_pc=ln_trademark-ln_pop

. gen ln_researcher_permm=ln(Researchers_RD_permm)

. gen ln_mobile_per100=ln(mobile_per100) 

. gen ln_broadband_per100=ln(broadband_per100) 

. gen ln_electric_pc=ln(electric_percapita) 

. gen ln_freshwater_pc=ln(freshwater_percapita) 

. gen ln_air_transp=ln(air_transp) 
(3 missing values generated)

. gen ln_container_port=ln(container_port)
(3 missing values generated)

. gen ln_schooling=ln(schooling)

. egen gov_index=rowmean(PoliticalStability GovernmentEffectiveness RegulatoryQuality RuleofLaw ControlofCorruption)

. egen gov_rank_index=rowmean(PoliticalStability_rank GovernmentEffectiveness_rank RegulatoryQuality_rank RuleofLaw_rank ControlofCorruption_rank)

. 
. tempfile temp

. save `temp', replace    
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp saved

. 
. 
. 
. *Create table 2
. *----------------------------------------
. local var_dep "D_A_phi"

. local typefirm "ln_patent_pc"

. local abslist "year"

. local clusterlist "isocode"

. local variablelist "k_y ln_hc RuleofLaw"

. local yy=2016

. local grvar0 "gdp_pw_ppp" 

. 
. local vardep "ln_`grvar0'"

. reghdfe `vardep' k_y ln_hc  if year==2016, abs(`abslist')  vce(cluster `clusterlist')
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+

. 
. 
. 
. foreach vardep in "ln_`grvar0'" "D_A_phi" "b_D_A_phi"  {
  2. display "`vardep'"
  3. 
. reghdfe `vardep' k_y ln_hc  if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  4. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  5. 
. reghdfe `vardep' k_y ln_hc  gov_rank_index ln_mobile_per100 ln_patent_pc if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  6. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  7. 
. }
ln_gdp_pw_ppp
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =       7.33
Statistics robust to heteroskedasticity           Prob > F        =     0.0004
                                                  R-squared       =     0.5248
                                                  Adj R-squared   =     0.4117
                                                  Within R-sq.    =     0.5248
Number of clusters (isocode) =         27         Root MSE        =     0.2102

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
   ln_gdp_pw_ppp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |   .1826241   .1871454     0.98   0.340    -.2065661    .5718143
           ln_hc |  -.1573474    .629992    -0.25   0.805    -1.467488    1.152793
  gov_rank_index |   .6889771   .3849486     1.79   0.088    -.1115674    1.489522
ln_mobile_per100 |  -.0643084   .5971252    -0.11   0.915    -1.306098    1.177481
    ln_patent_pc |   .0841197   .0365542     2.30   0.032      .008101    .1601384
           _cons |  -.9890033   .3462323    -2.86   0.009    -1.709033   -.2689739
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
D_A_phi
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       0.14
Statistics robust to heteroskedasticity           Prob > F        =     0.8716
                                                  R-squared       =     0.0069
                                                  Adj R-squared   =    -0.0758
                                                  Within R-sq.    =     0.0069
Number of clusters (isocode) =         27         Root MSE        =     0.1683

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
     D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   -.049236   .0941831    -0.52   0.606    -.2436204    .1451484
       ln_hc |  -.0235642   .2734426    -0.09   0.932     -.587922    .5407937
       _cons |  -.2036515   .0307751    -6.62   0.000    -.2671683   -.1401347
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =      12.17
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.6063
                                                  Adj R-squared   =     0.5125
                                                  Within R-sq.    =     0.6063
Number of clusters (isocode) =         27         Root MSE        =     0.1133

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
         D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |  -.0486077   .1036058    -0.47   0.644    -.2640678    .1668523
           ln_hc |  -.3289669   .2130335    -1.54   0.137    -.7719943    .1140606
  gov_rank_index |  -.1346177   .2044615    -0.66   0.517    -.5598187    .2905833
ln_mobile_per100 |  -.1039685   .3395624    -0.31   0.762    -.8101272    .6021903
    ln_patent_pc |   .1093853   .0206781     5.29   0.000     .0663828    .1523878
           _cons |   .0224591   .1905609     0.12   0.907     -.373834    .4187522
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
b_D_A_phi
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       5.88
Statistics robust to heteroskedasticity           Prob > F        =     0.0084
                                                  R-squared       =     0.3593
                                                  Adj R-squared   =     0.3059
                                                  Within R-sq.    =     0.3593
Number of clusters (isocode) =         27         Root MSE        =     0.1875

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
b_D_A_phi_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .4278544    .127202     3.36   0.003     .1653224    .6903864
       ln_hc |   .7958388   .3492222     2.28   0.032     .0750797    1.516598
       _cons |  -.1699756   .0386292    -4.40   0.000    -.2497024   -.0902489
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =      14.56
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.6410
                                                  Adj R-squared   =     0.5555
                                                  Within R-sq.    =     0.6410
Number of clusters (isocode) =         27         Root MSE        =     0.1501

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
b_D_A_phi_gdp_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |   .2312318   .1024663     2.26   0.035     .0181414    .4443222
           ln_hc |   .1716194   .5242396     0.33   0.747    -.9185965    1.261835
  gov_rank_index |   .8235949   .2344593     3.51   0.002     .3360101     1.31118
ln_mobile_per100 |   .0396601   .3175284     0.12   0.902    -.6206763    .6999964
    ln_patent_pc |  -.0252656   .0255349    -0.99   0.334    -.0783684    .0278371
           _cons |  -1.011462   .2034154    -4.97   0.000    -1.434488   -.5884369
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout

. *
. 
. 
. 
. 
. 
. 
. 
. 
end of do-file

. do "F:\Dropbox (UBC-Umich)\Research_Projects\Project Javier and Natalia\TFP firm\TFP_firm_data_historical\dataverse_files\code\main\table_02_correlation.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: table_02_correlation.do
> Date: October 2022
> 
> Description: Reproduces Table 2: Correlations with country characteristics.
> 
> *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_02_correlation.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. ************************ TABLE 2  **************************
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
. 
. *Bring some aggregate control variables
. *----------------------------------------------------------
. merge m:1 year isocode using "${data}/additional_agg_indicators.dta"

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,290
        from master                         0  (_merge==1)
        from using                      1,290  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(1,290 observations deleted)

. drop _merge

. 
. gen k_y=ln_ck-ln_rgdpo

. gen ln_patent=ln(patent_total)

. gen ln_patent_pc=ln_patent-ln_pop

. gen ln_trademark=ln(trademark_application)

. gen ln_trademark_pc=ln_trademark-ln_pop

. gen ln_researcher_permm=ln(Researchers_RD_permm)

. gen ln_mobile_per100=ln(mobile_per100) 

. gen ln_broadband_per100=ln(broadband_per100) 

. gen ln_electric_pc=ln(electric_percapita) 

. gen ln_freshwater_pc=ln(freshwater_percapita) 

. gen ln_air_transp=ln(air_transp) 
(3 missing values generated)

. gen ln_container_port=ln(container_port)
(3 missing values generated)

. gen ln_schooling=ln(schooling)

. egen gov_index=rowmean(PoliticalStability GovernmentEffectiveness RegulatoryQuality RuleofLaw ControlofCorruption)

. egen gov_rank_index=rowmean(PoliticalStability_rank GovernmentEffectiveness_rank RegulatoryQuality_rank RuleofLaw_rank ControlofCorruption_rank)

. 
. tempfile temp

. save `temp', replace    
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp saved

. 
. 
. 
. *Create table 2
. *----------------------------------------
. local var_dep "D_A_phi"

. local typefirm "ln_patent_pc"

. local abslist "year"

. local clusterlist "isocode"

. local variablelist "k_y ln_hc RuleofLaw"

. local yy=2016

. local grvar0 "gdp_pw_ppp" 

. 
. local vardep "ln_`grvar0'"

. reghdfe `vardep' k_y ln_hc  if year==2016, abs(`abslist')  vce(cluster `clusterlist')
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+

. 
. 
. 
. foreach vardep in "ln_`grvar0'" "D_A_phi" "b_D_A_phi"  {
  2. display "`vardep'"
  3. 
. reghdfe `vardep' k_y ln_hc  if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  4. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  5. 
. reghdfe `vardep' k_y ln_hc  gov_rank_index ln_mobile_per100 ln_patent_pc if year==`yy', abs(`abslist')  vce(cluster `clusterlist')
  6. outreg2 using "${rmain}/table_02.xls", br ctitle(OLS levels, type: "agg (lp), year `yy'", var_dep: `vardep', FE: `abslist', cluster (`clusterlist')) append 
  7. 
. }
ln_gdp_pw_ppp
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       3.07
Statistics robust to heteroskedasticity           Prob > F        =     0.0650
                                                  R-squared       =     0.2012
                                                  Adj R-squared   =     0.1346
                                                  Within R-sq.    =     0.2012
Number of clusters (isocode) =         27         Root MSE        =     0.2549

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
ln_gdp_pw_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .3786184    .178764     2.12   0.045     .0096676    .7475692
       ln_hc |   .7722747   .4240589     1.82   0.081    -.1029399    1.647489
       _cons |  -.3736271    .052597    -7.10   0.000     -.482182   -.2650722
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =       7.33
Statistics robust to heteroskedasticity           Prob > F        =     0.0004
                                                  R-squared       =     0.5248
                                                  Adj R-squared   =     0.4117
                                                  Within R-sq.    =     0.5248
Number of clusters (isocode) =         27         Root MSE        =     0.2102

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
   ln_gdp_pw_ppp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |   .1826241   .1871454     0.98   0.340    -.2065661    .5718143
           ln_hc |  -.1573474    .629992    -0.25   0.805    -1.467488    1.152793
  gov_rank_index |   .6889771   .3849486     1.79   0.088    -.1115674    1.489522
ln_mobile_per100 |  -.0643084   .5971252    -0.11   0.915    -1.306098    1.177481
    ln_patent_pc |   .0841197   .0365542     2.30   0.032      .008101    .1601384
           _cons |  -.9890033   .3462323    -2.86   0.009    -1.709033   -.2689739
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
D_A_phi
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       0.14
Statistics robust to heteroskedasticity           Prob > F        =     0.8716
                                                  R-squared       =     0.0069
                                                  Adj R-squared   =    -0.0758
                                                  Within R-sq.    =     0.0069
Number of clusters (isocode) =         27         Root MSE        =     0.1683

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
     D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   -.049236   .0941831    -0.52   0.606    -.2436204    .1451484
       ln_hc |  -.0235642   .2734426    -0.09   0.932     -.587922    .5407937
       _cons |  -.2036515   .0307751    -6.62   0.000    -.2671683   -.1401347
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =      12.17
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.6063
                                                  Adj R-squared   =     0.5125
                                                  Within R-sq.    =     0.6063
Number of clusters (isocode) =         27         Root MSE        =     0.1133

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
         D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |  -.0486077   .1036058    -0.47   0.644    -.2640678    .1668523
           ln_hc |  -.3289669   .2130335    -1.54   0.137    -.7719943    .1140606
  gov_rank_index |  -.1346177   .2044615    -0.66   0.517    -.5598187    .2905833
ln_mobile_per100 |  -.1039685   .3395624    -0.31   0.762    -.8101272    .6021903
    ln_patent_pc |   .1093853   .0206781     5.29   0.000     .0663828    .1523878
           _cons |   .0224591   .1905609     0.12   0.907     -.373834    .4187522
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
b_D_A_phi
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   2,     24) =       5.88
Statistics robust to heteroskedasticity           Prob > F        =     0.0084
                                                  R-squared       =     0.3593
                                                  Adj R-squared   =     0.3059
                                                  Within R-sq.    =     0.3593
Number of clusters (isocode) =         27         Root MSE        =     0.1875

                               (Std. Err. adjusted for 27 clusters in isocode)
------------------------------------------------------------------------------
             |               Robust
b_D_A_phi_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         k_y |   .4278544    .127202     3.36   0.003     .1653224    .6903864
       ln_hc |   .7958388   .3492222     2.28   0.032     .0750797    1.516598
       _cons |  -.1699756   .0386292    -4.40   0.000    -.2497024   -.0902489
------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout
(MWFE estimator converged in 1 iterations)

HDFE Linear regression                            Number of obs   =         27
Absorbing 1 HDFE group                            F(   5,     21) =      14.56
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.6410
                                                  Adj R-squared   =     0.5555
                                                  Within R-sq.    =     0.6410
Number of clusters (isocode) =         27         Root MSE        =     0.1501

                                   (Std. Err. adjusted for 27 clusters in isocode)
----------------------------------------------------------------------------------
                 |               Robust
b_D_A_phi_gdp_~p |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
             k_y |   .2312318   .1024663     2.26   0.035     .0181414    .4443222
           ln_hc |   .1716194   .5242396     0.33   0.747    -.9185965    1.261835
  gov_rank_index |   .8235949   .2344593     3.51   0.002     .3360101     1.31118
ln_mobile_per100 |   .0396601   .3175284     0.12   0.902    -.6206763    .6999964
    ln_patent_pc |  -.0252656   .0255349    -0.99   0.334    -.0783684    .0278371
           _cons |  -1.011462   .2034154    -4.97   0.000    -1.434488   -.5884369
----------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |         1           0           1     |
-----------------------------------------------------+
F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/table_02.xls
dir : seeout

. *
. 
. 
. 
. 
. 
. 
. 
. 
end of do-file

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. cap log close
